package com.jinzhi.oss.controller;

import com.jinzhi.common.utils.ApiResult;
import com.jinzhi.oss.service.OssService;
import com.jinzhi.sys.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;



/**
 * @author mengzhichao
 * @create 2022-08-30-9:28
 */
@RestController
@RequestMapping("/jinZhiIndex/Oss")
public class OssController {

    @Autowired
    OssService ossService;

    @Autowired
    UserService userService;


    /**
     * api小程序端-文件上传接口
     */
    @PostMapping("/fileImprot")
    @Transactional
    public ApiResult<?> fileImprot(@RequestParam("file") MultipartFile file) {
        String url = "";
        url = ossService.uploadFileOss2(file);
        System.out.println("分片上传视频地址++++++++++++++++++++++++++++++++++++++++++"+url);
        return ApiResult.success("上传成功", url);
    }


}
